package com.hs.mobile.service.notifications;

import java.util.Date;
import java.util.List;

import com.hs.mobile.model.Notifications;
import com.hs.mobile.dao.notifications.NotificationsDAO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("notificationsService")
public class NotificationsServiceImpl implements NotificationsService {

	@Autowired
	NotificationsDAO notificationsDAO;
	/**
	 * @name setter NotificationsDAO
	 * @param notificationsDAO
	 */
	public void setNotificationsDAO( NotificationsDAO notificationsDAO )
	{
		this.notificationsDAO = notificationsDAO;
	}
	/**
	 * 
	 * @return notificationsDAO
	 */
	public NotificationsDAO getNotificationsDAO()
	{
		return notificationsDAO;
	}
	
	@Override
	public void save(Notifications notifications) {
		// TODO Auto-generated method stub
		System.out.println("__ save notifications __");
		notificationsDAO.add(notifications);
	}

	@Override
	public void update(Notifications notifications) {
		// TODO Auto-generated method stub
		System.out.println("__ update Notifications __");
		notificationsDAO.update(notifications);		
	}

	@Override
	public void delete(long id) {
		// TODO Auto-generated method stub
		System.out.println("__ Delete notifications __");
		Notifications delNotifications = (Notifications) notificationsDAO.getById(id);
		notificationsDAO.delete(delNotifications);
	}

	@Override
	public void updateStatus(long id, int status, Date modified) {
		// TODO Auto-generated method stub
		System.out.println("__ update notifications __");
		Notifications upNotifications = (Notifications) notificationsDAO.getById(id);
		upNotifications.setUpdateStatus(status);
		notificationsDAO.add(upNotifications);
	}

	@Override
	public Notifications findNotificationsById(long id) {
		// TODO Auto-generated method stub
		System.out.println("__ findNotifications __");
		Notifications notifications = (Notifications) notificationsDAO.findByNotificationId(id);
		return notifications;
	}

	@Override
	public List<Notifications> getAllNotifications() {
		// TODO Auto-generated method stub
		System.out.println("__ get totally Notifications __ ");
		List<Notifications> listNotifications = notificationsDAO.getListAll();
		return listNotifications;
	}

	@Override
	public List<Notifications> getNotificationsByDeviceId(long deviceId) {
		// TODO Auto-generated method stub
		System.out.println("__ get totally Notifications __ ");
		List<Notifications> listNotifications = notificationsDAO.getNotificationsByDeviceId(deviceId);
		return listNotifications;
	}

	@Override
	public List<Notifications> getNotificationsByServiceId(long serviceId) {
		// TODO Auto-generated method stub
		System.out.println("__ get totally Notifications __ ");
		List<Notifications> listNotifications = notificationsDAO.getNotificationsByServiceId(serviceId);
		return listNotifications;
	}

}
